<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <h1>组件式编程==>{{currentTime}}</h1>
        <h2>组件1</h2>
        <zu-jian-1></zu-jian-1>
        <h2>组件2</h2>
        <zu-jian-1></zu-jian-1>
    </div>
</body>

<script src="./js/vue.js"></script>
<script>

    const zj1 = Vue.extend({
        name: 'my-zujian1',
        template: `<h1>组件1==>{{num}}<button @click="num++">点击数字+1</button></h1>`,
        data() {
            return {
                num: 0
            }
        },
        mounted() {
            console.log(this);
        },
    })

    const zj2 = Vue.extend({
        template: `<h1>组件2==>{{num}}<button @click="num++">点击数字+1</button></h1>`,
        data() {
            return {
                num: 0
            }
        }
    })

    const vm = new Vue({
        el: '#app',
        data: {
            currentTime: '2024年9月26日10:11:34',
        },
        components: {
            "zu-jian-1": zj1,
            "zu-jian-2": zj2        
        }
    })

    function ahh() {
        return {
            a: 1,
            b: 2
        }
    }
    const x = ahh();
    const y = ahh();

    console.log(vm);

</script>
</html>